<?php 
defined('_JEXEC') or die;

// disable core styles to avoid bs conflict 
OC_Util::$core_styles = array();

$keyword = JRequest::getString('q', '');
$source = $_['source'];
?>

<?php if(count($_['jobcitylist']) >= 2): ?>
<div class="cityselect medium songti">
   <span><b>按地区</b>：</span>
   <?php 
   list($href, $selected) = PResumesHelper::getSearchItemHref($_['cityPageUrl'], 'jc', 'all');
   if(!empty($source)){
      $href .= (strpos($href, '?') == false ? '?':'&').'source='.$source;
   }
   ?>
   <a href="<?=($selected ? 'javascript:;' : $href)?>" class="displaylist <?=($selected ? 'cur_a'  : '')?>">全部</a>
   <?php 
   if(isset($_['jobcitylist']) && !empty($_['jobcitylist'])) {
      foreach ($_['jobcitylist'] as $jobcity) {
         list($href, $selected) = PResumesHelper::getSearchItemHref($_['cityPageUrl'], 'jc', $jobcity['cityid']);
         if(!empty($source)){
            $href .= (strpos($href, '?') == false ? '?':'&').'source='.$source;
         }
   ?>
   <a href="<?=($selected ? 'javascript:;' : $href)?>" class="displaylist <?=($selected ? 'cur_a'  : '')?>"><?php echo ProvinceHelper::getMuniProvinceId($jobcity['cityid']) ? $jobcity['province'] : $jobcity['province'] . $jobcity['city']?></a>
   <?php 
      }
   }
   ?>
</div>
<?php endif; ?>

<?php if(count($_['jobikeylist']) >= 2): ?>
<div class="selectletter medium songti">
   <span><b>按拼音</b>：</span>
   <?php 
   list($href, $selected) = PResumesHelper::getSearchItemHref($_['ikeyPageUrl'], 'ik', 'all');
   if(!empty($source)){
      $href .= (strpos($href, '?') == false ? '?':'&').'source='.$source;
   }
   ?>
   <a href="<?=($selected ? 'javascript:;' : $href)?>" class="displaylist <?=($selected ? 'cur_a'  : '')?>">全部</a>
   <?php 
   if(isset($_['jobikeylist']) && !empty($_['jobikeylist'])) {
      foreach ($_['jobikeylist'] as $jobikey) {
         list($href, $selected) = PResumesHelper::getSearchItemHref($_['ikeyPageUrl'], 'ik', $jobikey);
         if(!empty($source)){
            $href .= (strpos($href, '?') == false ? '?':'&').'source='.$source;
         }
   ?>
   <a href="<?=($selected ? 'javascript:;' : $href)?>" class="displaylist <?=($selected ? 'cur_a'  : '')?>"><?=strtoupper($jobikey == 'other' ? '其他' : $jobikey)?></a>
   <?php 
      }
   }
   ?>
</div>
<?php endif; ?>

<?php if (empty($_['jobList'])): ?>
<div class="postionlisttable_nodata large yahei" style="text-align: center;">没有对应的职位</div>
<?php else: ?>
<div class="postionlisttable medium joblist">
   <table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
         <?php 
         $n=count($_['jobList']);
         for ($i=0; $i < $n; $i++) {
            $job = $_['jobList'][$i];
            if ($i != 0 && ($i%3) == 0) {
               echo '</tr><tr>';
            }
            $jobData = "{'jobtitle': '" . addslashes($job['job_title']) . "', 'jobid': '" . $job['id'] . "'}";
         ?>
         <td width="33%"><a href="javascript:;" class="selectitem" data="<?=$jobData?>"><?=$job['job_title']?></a></td>
         <?php 
         }
         
         $filledNum = 3 - ($n%3);
         if ($filledNum < 3) {
            for ($i=0; $i < $filledNum; $i++) {
               echo '<td width="33%"></td>';
            }
         }
         ?>
      </tr>
   </table>
</div>
<?php endif; ?>
